<template>
	<el-container>
		<el-header>
			<div class="left-panel">
				<el-button type="info" icon="el-icon-refresh" @click="refresh"></el-button>
			</div>
			<div class="right-panel">
				<div class="right-panel-search">
					<el-date-picker
					      v-model="datetime"
					      type="datetimerange"
					      range-separator="至"
					      start-placeholder="开始时间"
					      end-placeholder="结束时间"
					    />
					<el-input v-model="search.keyword" placeholder="会员昵称/会员手机/编号" clearable style="width: 150px;"></el-input>
					<el-button type="primary" icon="el-icon-search" @click="upsearch"></el-button>
				</div>
			</div>
		</el-header>
		<el-main class="nopadding">
			<scTable ref="table" :apiObj="apiObj" row-key="id" @selection-change="selectionChange" stripe>
				<el-table-column label="ID" prop="id" width="70" align="center"></el-table-column>
                <el-table-column label="充值编号" prop="ordernum"></el-table-column>
				<el-table-column label="流水号" prop="tradenum" width="250" align="center"></el-table-column>
				<el-table-column label="充值金额" prop="money" width="150" align="center">
                        <template #default="scope">
                            <span class="red">{{scope.row.money}}</span>
                        </template>
                </el-table-column>
                <el-table-column label="类型" prop="money" width="150" align="center">
                        <template #default="">
                            余额充值
                        </template>
                </el-table-column>
                <el-table-column label="充值时间" prop="create_time" width="220" align="center"></el-table-column>
                <el-table-column label="充值人" prop="wx_name" width="180" align="center"></el-table-column>
				<el-table-column label="状态" prop="status" align="center">

						<el-tag type="success">成功</el-tag>

				</el-table-column>


			</scTable>
		</el-main>
	</el-container>
</template>

<script>
	export default {
		name: 'goodscat',
		data() {
			return {
				dialog: {
					save: false
				},
				datetime:[],
				apiObj: this.$API.system.recharge.list,
				selection: [],
				search: {
					keyword: null
				}
			}
		},
		methods: {
			//添加
			add(){
				this.dialog.save = true
				this.$nextTick(() => {
					this.$refs.savecatDialog.open()
				})
			},
			//编辑
			table_edit(row){
				this.dialog.save = true
				this.$nextTick(() => {
					this.$refs.savecatDialog.open('edit').setData(row)
				})
			},
			//查看
			table_show(row){
				this.dialog.save = true
				this.$nextTick(() => {
					this.$refs.saveDialog.open('show').setData(row)
				})
			},
			//表格选择后回调事件
			selectionChange(selection){
				this.selection = selection;
			},
			//搜索
			upsearch(){
				this.search.time = this.datetime
				this.$refs.table.upData(this.search)
			},
            refresh(){
                this.$refs.table.reload()
            },
			//本地更新数据
			handleSaveSuccess(data, mode){
				console.log(mode,"sssssssssssssss")
				if(mode=='add'){
					this.$refs.table.reload()
				}else if(mode=='edit'){
					this.$refs.table.reload()
				}
			}
		}
	}
</script>

<style>
.red{
    font-size: 15px;
    color:#ff3333
}
</style>

